<template>
  <view>
    <u-tabbar
	:value="name"
	:fixed="true"
	:placeholder="true"
	:safeAreaInsetBottom="true"
>
  <u-tabbar-item v-for="(item,index) in tabbarList" :key="index" :text="item.text" :icon="item.icon" :name="item.name" @tap="navigateTo(item)"></u-tabbar-item>

</u-tabbar>
  </view>
</template>

<script>
export default {
  data() {
    return {
      value:'0',
      tabbarList: [
        { text: "首页", icon: "home" , name:'home',url:'/'},
        { text: "视频", icon: "photo" ,name:'xx',url:'/pages/index/index'},
        { text: "直播", icon: "play-right" ,name:'vv',url:'/pages/index/index'},
        { text: "我的", icon: "account" ,name:'user',url:'/pages/user/index'},
      ],
    }
  },
  props:{
    name:{
      type:String,
      required:true,
    }
  },
  methods: {
    navigateTo(item){
      if(item.name == this.name) return
      uni.navigateTo({
        url: item.url
      })
      // uni.redirectTo({
      //   url: item.url
      // });
    }
  },
}
</script>